package com.candy.test;

import com.candy.dao.AccountDao;
import com.candy.dao.impl.AccountDaoImpl;
import com.candy.model.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Client {
    public static void main(String[] args) {
        //1.使用 ApplicationContext 接口，就是在获取 spring 容器
        ApplicationContext ac= new  ClassPathXmlApplicationContext("beans.xml");
        //2.根据 bean 的 id 获取对象
        AccountService accountService=(AccountService)ac.getBean("accountService");
        System.out.println(accountService);
       AccountDao accountDao= ac.getBean("accountDao", AccountDaoImpl.class);
        System.out.println(accountDao);




    }
}
